package com.lv.phuotbacnam.bl.log;

import android.util.Log;

/**
 * Base logging component
 */
public class Logger {

    /**Debug tag*/
    public static final String TAG = "TAG";

    /**Whether this logger should print output*/
    private static boolean active;

    public static void initialize(boolean active){
        Logger.active = active;
    }

    /**
     * Log a message to debug using the debug TAG
     * @param message Message to print
     */
    public static void logMessage(String message){
        logMessage(TAG, message);
    }

    /**
     * Log a message if the logger is active
     * @param tag Tag to use for logging
     * @param message Message to print
     */
    public static void logMessage(String tag, String message){
        if(active){
            Log.d(tag, message);
        }
    }

    /**
     * Log an error
     * @param message Error message
     * @param cause Cause of the error
     */
    public static void logError(String message, Throwable cause){
        if(active){
            Log.e(TAG, message, cause);
        }
    }
}
